package statistics;

import java.util.ArrayList;

import distributedRE.model.DistributedREModel;
import distributedRE.model.Document;
import distributedRE.model.QueryDatabase;
import distributedRE.model.Session;

public class NewTuplesExtracted implements DistributedREStatistic {

	public Double getLastSessionStatistic(DistributedREModel dREModel) {
		
		Session s = dREModel.getLastSession();
		
		String ie = dREModel.getInformationExtractor().getId();
		
		long relation = dREModel.getRelation().getId();
		
		ArrayList<ArrayList<Document>> documents = s.getDocumentLists();
		
		long tuples = 0;
		
		for (ArrayList<Document> arrayList : documents) {
			for (Document document : arrayList) {
				
				tuples += document.getTuples(ie, relation).size();
				
			}
		}
		
		return new Double((double)tuples);
		
	}

	public Double getQueryDatabaseStatistic(QueryDatabase queryDatabase) {
		// TODO Auto-generated method stub
		return null;
	}

}
